"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.妖术Handler = void 0;
const Config_1 = require("../../Config");
const Big_1 = require("../core/Big");
const GameUtils_1 = __importDefault(require("../GameUtils"));
const BaseHandler_1 = require("./BaseHandler");
const GameUtils_2 = __importDefault(require("../GameUtils"));
class 妖术Handler extends BaseHandler_1.BaseHandler {
    妖术_敲山震虎(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_妖术_敲山震虎);
        let point = this.gameMgr.map_point.get(data.end);
        for (let point of this.gameMgr.map_point.values()) {
            point.is_敲山震虎_flag = false;
        }
        let list = GameUtils_1.default.getArrPointsAsShan(this.gameMgr, point, new Array());
        for (let point of list) {
            let arr = GameUtils_1.default.getArrPointsAround(this.gameMgr, point);
            for (let pp of arr) {
                let big = pp.big;
                if (big != null) {
                    if (big.player != player) {
                        big.addState(Big_1.BigState.FEAR);
                    }
                }
            }
        }
    }
    妖术_绝命献祭(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_妖术_绝命献祭);
        let endPoint = this.gameMgr.map_point.get(data.end);
        let startPoint = this.gameMgr.map_point.get(data.start);
        let big_start = startPoint.big;
        big_start.actionOnce();
        let ys = big_start;
        let big_end = endPoint.big;
        let before_number = player.arr_bigs.size;
        big_end.die(player);
        let after_number = player.arr_bigs.size;
        ys.immolate(before_number - after_number);
        this.gameMgr.sendBroadcast(GameUtils_2.default.getObj("play_sound", { "sound": "妖术_献祭", "username": player.username }));
    }
    妖术_玄冰禁锢(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_妖术_玄冰禁锢);
        let startPoint = this.gameMgr.map_point.get(data.start);
        let big_start = startPoint.big;
        big_start.actionOnce();
        let endPoint = this.gameMgr.map_point.get(data.end);
        let big_end = endPoint.big;
        if (big_end == null) {
        }
        else {
            big_end.addState(Big_1.BigState.ICE);
        }
        this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("play_effect", { "effect": "妖术_冰冻", "point_id": endPoint.id, "username": player.username }));
    }
    妖术_瘟疫传播(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_妖术_瘟疫传播);
        let startPoint = this.gameMgr.map_point.get(data.start);
        let big_start = startPoint.big;
        big_start.actionOnce();
        let endPoint = this.gameMgr.map_point.get(data.end);
        let big_end = endPoint.big;
        if (big_end == null) {
        }
        else {
            big_end.addState(Big_1.BigState.METHYSIS);
        }
        this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("play_effect", { "effect": "妖术_瘟疫", "point_id": endPoint.id, "username": player.username }));
    }
}
exports.妖术Handler = 妖术Handler;
